#include "enemy.h"

//4 Sekawan
Enemy::Enemy(string _name, string _url, int _hp, int _type, int _cost, int _posx, int _posy, int _arah){
	name = _name;
	image_url = _url;
	HP = _hp;
	type= _type;
	cost = _cost;
	posx = _posx;
	posy = _posy;
	arah = _arah;
}

Enemy::Enemy(string _name, string _url, int _hp, int _type, int _cost){
	name = _name;
	image_url = _url;
	HP = _hp;
	type= _type;
	cost = _cost;
}

Enemy::~Enemy(){

}

Enemy::Enemy(const Enemy& E){
	name = E.name;
	image_url = E.image_url;
	HP = E.HP;
	type = E.type;
	cost = E.cost;
	posx = E.posx;
	posy = E.posy;
	arah = E.arah;
}

Enemy& Enemy::operator= (const Enemy E){
	name = E.name;
	image_url = E.image_url;
	HP = E.HP;
	type = E.type;
	cost = E.cost;
	posx = E.posx;
	posy = E.posy;
	arah = E.arah;
	return *this;
}

//Getter Setter
string Enemy::getName(){return name;}
string Enemy::getURL(){return image_url;}
int Enemy::getHP(){return HP;}
int Enemy::getType(){return type;}
int Enemy::getCost(){return cost;}
int Enemy::getPosX(){return posx;}
int Enemy::getPosY(){return posy;}

void Enemy::setName(string S){name = S;}
void Enemy::setURL(string S){image_url = S;}
void Enemy::setHP(int n){HP = n;}
void Enemy::setType(int n){type = n;}
void Enemy::setCost(int n){cost = n;}
void Enemy::setPosX(int n){posx = n;}
void Enemy::setPosY(int n){posy = n;}

void Enemy::move(sf::RenderWindow& window,sf::Sprite& s1){
	if (arah == South) {posy++;s1.SetPosition(posx,posy);window.Draw(s1);}
	else if (arah == North) {posy--;s1.SetPosition(posx,posy);window.Draw(s1);}
	else if (arah == East) {posx++;s1.SetPosition(posx,posy);window.Draw(s1);}
	else if (arah == West) {posx--;s1.SetPosition(posx,posy);window.Draw(s1);}
}

void Enemy::getDamage(int damage){HP = HP-damage;}
bool Enemy::isDead(){return (HP<0);}

void Enemy::moveEast(){ arah = East;}
void Enemy::moveWest(){ arah = West;}
void Enemy::moveNorth(){ arah = North;}
void Enemy::moveSouth(){ arah = South;}